package com.showcai.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.showcai.module.ProductEntity;
import com.showcai.myRunTime.MyRunTimeExcption;
import com.showcai.service.ProductEntityService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by Baggio on 2018-9-27.
 */
@Service("productEntityCertificateService")
public class ProductEntityCertificateServiceImpl extends ProductEntityBase implements ProductEntityService {
    @Override
    public ProductEntity modifyProductEntity(ProductEntity productEntity) throws MyRunTimeExcption {
        return null;
    }

    @Override
    public void stopAllProductEntity(Long productId) {

    }

    @Override
    public void operateAllProductEntity(Long productId) {

    }

    @Override
    public void stopProductEntity(Long tid) {

    }

    @Override
    public void operateProductEntity(Long tid) {

    }

    @Override
    public List<ProductEntity> getProductEntityListByProductId(Long productId) throws MyRunTimeExcption {
        return null;
    }

    @Override
    public List<ProductEntity> getProductEntityList(Map<String, String> map) throws MyRunTimeExcption {
        return null;
    }

    @Override
    public PageInfo getProductEntityPageList(Map<String, String> map) throws MyRunTimeExcption {
        return null;
    }

    @Override
    public ProductEntity getProductEntityById(Long productEntityId) throws MyRunTimeExcption {
        System.out.println("查询到的对象——————————————"+productEntityMapper.getProductEntityCertificateByProductEntityId(productEntityId));
        return productEntityMapper.getProductEntityCertificateByProductEntityId(productEntityId);
    }

    @Override
    public ProductEntity getProductEntity(Map<String, String> map) throws MyRunTimeExcption {
        return null;
    }

    @Override
    public PageInfo getPageInfoProductEntityList(Map<String, String> map) throws MyRunTimeExcption {
        Integer page = Integer.parseInt(map.get("page"));
        Integer pageSize = Integer.parseInt(map.get("pageSize"));
        PageHelper.startPage(page, pageSize);
        map.put("status",String.valueOf(ProductEntity.PRODUCT_ENTITY_STAUTS_VALID));
        List<ProductEntity> productEntityList = productEntityMapper.getProductEntityCertificateList(map);

        PageInfo<ProductEntity> pageinfo = new PageInfo<>(productEntityList);
        return pageinfo;
    }
}
